package com.ebspp.global;


import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;

/**
 * general global variables such as project diretory, db ecoding, etc
 * @author x23pan
 *
 */
public class General 
{
	public static final String encod = "UTF-8";
	public static final String dir = System.getProperty("user.dir");
	
	public static String getTS()
	{
		return "" + new Date().getTime();
	}
	public static long getT()
	{
		return new Date().getTime();
	}
	
	private static  int bufID = 1;
	public static synchronized int getBufID()
	{
		return bufID++;
	}
	
	public static String getServerName()
	{
		try {
			return InetAddress.getLocalHost().getHostAddress();
		} 
		catch (UnknownHostException e) {
			System.err.println("Cannot get local host ip address");
			e.printStackTrace();
			return null;
		}
	}

	
	public final static int writeBufSize = 10000;
	public final static int readBufSize = 10000;
	public final static int wFailBufSize = 1000;
	public final static int maxWaBufSize = 10000;
	public final static int failGBSize = 100;
	public final static int watcherBufSize = 10000;
	public final static int gbConnCloseCnt = 10;
	
	public final static int rPort = 3550;
	public final static int wPort = 3551;
	public final static int mPort = 3552;
	public final static int gbPort = 3553;
	public final static int waPort = 3554;
	
	public final static boolean inBufRead = false;
}
